import React from 'react'

import { add } from './redux/actions'
import { useSelector, useDispatch } from 'react-redux'
export default function Test() {
  console.log('Test组件更新了')
  const count = useSelector((state) => {
    return state.zs.count
  })

  // 返回store.dispatch函数
  const dispatch = useDispatch()
  return (
    <div>
      <p>{count}</p>
      <button
        onClick={() => {
          dispatch(add(1))
        }}
      >
        +
      </button>
    </div>
  )
}
